#include "sys.h"
#include "delay.h"
#include "led.h"
#include "key.h"
#include "beep.h"

void mainloop(void);

int keyflag=-1;

int main(void)
{		
	delay_init();  
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); 
	LED_Init();
	BEEP_Init();
	KEY_Init();
	
	mainloop();
	
	while(1);
}

void mainloop(void)
{
	while(1)
	{
		switch(keyflag%4)
		{
			case 0:
				beep();
				break;
			case 1:
				led0_1flash();	
				break;
			case 2:
				led1flash();	
				break;
			case 3:
				led0flash();		
				break;
			default:
				ledoff();
				break;
		}
	}
}



	


